﻿namespace WebOptimizer.Net.Services.V1
{
	public partial class Source : global::Sidvall.Data.ServiceDataRowBase, global::WebOptimizer.Data.ISource
	{
		#region Public Members

		#region IgnoredFiles

		private string _IgnoredFiles;
		public string IgnoredFiles
		{ 
			get
			{
				return _IgnoredFiles;
			}
			set
			{
				_IgnoredFiles = value;
			}
		}

		#endregion
		#region IncludeSubfolders

		private bool _IncludeSubfolders;
		public bool IncludeSubfolders
		{ 
			get
			{
				return _IncludeSubfolders;
			}
			set
			{
				_IncludeSubfolders = value;
			}
		}

		#endregion
		#region IsEnabled

		private bool _IsEnabled;
		public bool IsEnabled
		{ 
			get
			{
				return _IsEnabled;
			}
			set
			{
				_IsEnabled = value;
			}
		}

		#endregion
		#region Path

		private string _Path;
		public string Path
		{ 
			get
			{
				return _Path;
			}
			set
			{
				_Path = value;
			}
		}

		#endregion
		#region SearchPatterns

		private string _SearchPatterns;
		public string SearchPatterns
		{ 
			get
			{
				return _SearchPatterns;
			}
			set
			{
				_SearchPatterns = value;
			}
		}

		#endregion
		#region SourceId

		private System.Nullable<int> _SourceId;
		public System.Nullable<int> SourceId
		{ 
			get
			{
				return _SourceId;
			}
			set
			{
				_SourceId = value;
			}
		}

		#endregion
		#region TaskId

		private int _TaskId;
		public int TaskId
		{ 
			get
			{
				return _TaskId;
			}
			set
			{
				_TaskId = value;
			}
		}

		#endregion
		#region IsDirty

		protected override bool IsDirty
		{
			get
			{
				return global::WebOptimizer.SystemContext.Current.EntityFacade.SourceManager.IsDirty(this);
			}
		}

		#endregion
		
		public Task Task { get; set; }
		#region LoadInstanceField

		public void LoadInstanceField(global::WebOptimizer.Data.Fields.SourceField fieldId, object value, bool cascade)
		{
			global::WebOptimizer.SystemContext.Current.EntityFacade.SourceManager.LoadInstanceField(this, fieldId, value, cascade, false, false);
		}
		public void LoadInstanceField(string fieldName, object value, bool cascade)
		{
			global::WebOptimizer.SystemContext.Current.EntityFacade.SourceManager.LoadInstanceField(this, fieldName, value, cascade, false, false);
		}

		#endregion
		#region Copy

		public Source Copy()
		{
			return global::WebOptimizer.SystemContext.Current.EntityFacade.SourceManager.Copy(this) as Source;
		}
		public Source Copy(Sidvall.Data.CopySettings settings)
		{
			return global::WebOptimizer.SystemContext.Current.EntityFacade.SourceManager.Copy(this, settings) as Source;
		}

		#endregion
		#region Import

		public void Import(global::WebOptimizer.Data.ISource item)
		{
			global::WebOptimizer.SystemContext.Current.EntityFacade.SourceManager.Import(this, item);
		}
		public void Import(global::WebOptimizer.Data.ISource item, Sidvall.Data.CopySettings settings)
		{
			global::WebOptimizer.SystemContext.Current.EntityFacade.SourceManager.Import(this, item, settings);
		}

		#endregion
		#region Validate

		public Sidvall.Data.BrokenRuleCollection Validate()
		{
			return global::WebOptimizer.SystemContext.Current.EntityFacade.SourceManager.Validate(this);
		}
		public Sidvall.Data.BrokenRuleCollection Validate(Sidvall.Data.ValidationSettings settings)
		{
			return global::WebOptimizer.SystemContext.Current.EntityFacade.SourceManager.Validate(this, settings);
		}

		#endregion

		#region ISource Members

		string global::WebOptimizer.Data.ISource.IgnoredFiles
		{
			get
			{
				return this._IgnoredFiles;
			}
			set
			{
				this._IgnoredFiles = value;
			}
		}
		bool global::WebOptimizer.Data.ISource.IncludeSubfolders
		{
			get
			{
				return this._IncludeSubfolders;
			}
			set
			{
				this._IncludeSubfolders = value;
			}
		}
		bool global::WebOptimizer.Data.ISource.IsEnabled
		{
			get
			{
				return this._IsEnabled;
			}
			set
			{
				this._IsEnabled = value;
			}
		}
		string global::WebOptimizer.Data.ISource.Path
		{
			get
			{
				return this._Path;
			}
			set
			{
				this._Path = value;
			}
		}
		string global::WebOptimizer.Data.ISource.SearchPatterns
		{
			get
			{
				return this._SearchPatterns;
			}
			set
			{
				this._SearchPatterns = value;
			}
		}
		System.Nullable<int> global::WebOptimizer.Data.ISource.SourceId
		{
			get
			{
				return this._SourceId;
			}
			set
			{
				this._SourceId = value;
			}
		}
		int global::WebOptimizer.Data.ISource.TaskId
		{
			get
			{
				return this._TaskId;
			}
			set
			{
				this._TaskId = value;
			}
		}
		global::WebOptimizer.Data.ITask global::WebOptimizer.Data.ISource.Task
		{
			get
			{
				return this.Task;
			}
			set
			{
				this.Task = value as Task;
			}
		}

		#endregion

		#endregion
		#region Constructors

		public Source()
		{
		}

		public Source(bool initializeDefaultValues)
			: this(initializeDefaultValues, null)
		{
		}

		public Source(bool initializeDefaultValues, Sidvall.Data.DataRowState? dataRowState)
			: base(dataRowState)
		{
			if (initializeDefaultValues)
				global::WebOptimizer.SystemContext.Current.EntityFacade.SourceManager.InitializeDefaultValues(this);
		}

		#endregion
	}
}